#ifndef LOADER_H
#define LOADER_H
#include <QString>
#include "geometrydata.h"
#include <QFile>
#include <QObject>
#include <QAtomicInt>
#include <QTextStream>
class Loader: public QObject
{
     Q_OBJECT

signals:
    void finished();
    void progressChanged(int, QString );

public slots:
    void load();

public:
    Loader(QString filename, GeometryData *data);
    Loader() {}

    QString getError() {return error_message_;}

private:
    void setErrorMessage(QString error) { error_message_ = error; }

    QString filename_;
    QAtomicInt progress_;
    GeometryData *data_;
    QString error_message_;

    bool triangleLoader(GeometryData *data,  QTextStream &in);
    bool pointsLoader(GeometryData *data,  QTextStream &in);
    bool contourLoader(GeometryData *data,  QTextStream &in);
};



#endif // LOADER_H
